Copyright (c) 1991-1993 Borland International, Inc. All Rights Reserved. This document describes the sample program files, which are installed in the SAMPLES subdirectory. Several programs use Bladerunner's new Open Window syntax, which lets you run multiple programs simultaneously. For example, start Contact.prg by either typing DO CONTACT in the Command Window or double-clicking on its icon in the File Viewer. After Contact's window appears, you can start Winapi.prg, again either through the Command Window or the File Viewer, and switch freely between the two windows. ANIMALS.PRG ----------- Files used: Animals.dbf, Animals.dbt This program shows how Bladerunner's window objects defined on database fields are related and change as the record pointer changes. It also displays Bladerunner's imaging commands. A window is defined with a listbox of image names and the image corresponding to the currently highlighted name. The image is stored in a memo field in Animals.dbf. BINTREE.PRG ----------- Files used: Clients.dbf, Clients.dbt This program shows how you can use Bladerunner's object extensions to create a binary tree. It builds a tree of clients' names, from clients.dbf, in alphabetical order. The tree goes left to right alphabetically, i.e. left child, parent, right child. CONTACT.PRG ----------- Files used: Company.dbf, Summary.dbf, Summary.mdx, Contact.dbf, Contact.mdx, Company.dbt, Company.mdx, Sampproc.prg This program relates 3 tables, and shows how Bladerunner's window controls work together and change as the record pointer moves in the main table. It defines a window with a listbox containing the names of companies, a radiobutton with company types, and an editor showing notes for a company. You can select the "Browse" pushbutton to browse the whole table of companies or the "Graph" pushbutton to look at the regression graph of the currently selected company's figures. All non-pushbutton controls change as you move through the listbox to reflect the current state of all related tables. DLLSAMP.PRG ----------- Calls: MessageBox() (external function) This program makes an API call to the Windows function MessageBox(), which brings up a dialog corresponding to the parameters specified in this function. It shows how easily Bladerunner can interface with external libraries. DUMP.PRG -------- Parameters: O (name of an object) This program lets you view the name and value of each property in the parameter object by calling the enum() function. Enum() creates a linked list of the object's properties. For instance, you can create a window, MyWindow, and can view its properties with: MyWindow = NEW Window() DO DUMP WITH MyWindow EVENT.PRG --------- Files used: Sampproc.prg This is a procedure file containing event-driven functions. If you DO Event, you can then call MakeButtonWindow() which creates a window with one pushbutton. Clicking on different areas in the window will move the button to that spot, and change the button's caption to show the current coordinates. Shift-click creates a new button, and Ctrl-click aligns all buttons. You can also call MakeSizeWindow() which will change its size as you move the mouse. Each of these events is made possible by Bladerunner's event handling functions, which can be assigned to different objects, and executed as the event happens. Here, for example, the events are pressing down the left mouse button, moving the mouse, and changing the size of the window. FOCUS2.PRG ---------- Files used: Sampproc.prg This program creates 2 instances of a user-defined window class, and then changes the properties of each of the windows depending on which one has focus. It uses the OnGotFocus and OnLostFocus event handlers to trap and change the current state of the current window's caption and contents. This is a simple but powerful example of how Bladerunner's object syntax handles events. The core of FOCUS2 is just 3 lines of code. These three lines set a procedure, and create two window objects. After that, everything is handled either automatically, or by the members of the window objects. FONT.PRG -------- Shows how to set different fonts and colors for Bladerunner's window controls. Currently fonts can be set for text, entryfields, and pushbuttons. GRF.PRG ------- Files used: Sixgraph.dbf, Bar.grf, Pie.grf, Line.grf, Regr.grf, Scat.grf, Step.grf Defines a window with 6 different graph objects. This program shows the different types of graphs you can use and create using Bladerunner. Each graph shows a different view of research data collected in sixgraph.dbf. IMAGE.PRG --------- Files used: Country.dbf, Country.dbt, Eurpie.grf Brings up a window containing a representation of the GNP of some European countries. The GNP is represented in a pie graph object. The window also contains an image of a map of Europe with the currently selected country highlighted. Selecting a slice of the pie changes the map to the corresponding country, and shows the name of the country and its capital. LINKLIST.PRG ------------ This is a simple program that creates a linked list of integers from 1 to 10. Each link has a value and next properties. After the list is created, a function is called to step through it and display the contents of each link. OPENWIND.PRG ------------ Files used: Country.dbf, Country.dbt, Sampproc.prg This program shows how Bladerunner's OPEN WINDOW command works. OPEN WINDOW displays a window and enables the objects it contains, but doesn't stop program control flow. In this program, you can select a country in one window, then view information about that country in a second window. You can then select more countries from the first window, and bring up windows with information about them. All information windows will stay on the screen until you close them. PICTURES.PRG ------------ Files used: Pictures.dbf, Pictures.dbt This program shows how Bladerunner's window objects defined on table fields are related and change as the record pointer changes. It also displays Bladerunner's imaging and sound commands. A window is defined with a listbox of image names and the image corresponding to the currently highlighted name. There is also a sound button that will play a sound corresponding to the image. Both the image and the sound are stored in memo fields in Pictures.dbf. PUZZLE.PRG ---------- Calls: Sampproc.prg, DeleteObject(),SelectObject(),CreatePen(),GetDC(),ReleaseDC() MoveTo(),LineTo(),SetTextColor(),FillRect(),CreateSolidBrush() (external functions) This program shows how you can use the object syntax to create a simple game. It also shows how the object extensions and windows API functions can be used to create a simple painter. A window is displayed with three pushbuttons -- Puzzle, Draw Window, Paint Window. The Puzzle pushbutton creates a window with a 15 button puzzle. The Draw Window pushbutton creates a window that lets you paint rays in different colors, and the Paint Window creates a window that lets you draw different colored lines. You can create as many windows as you like with each activity. Puzzle.prg is programmed using Bladerunner's object syntax, and is completely event driven. SHOWPROP.PRG ------------ This is an introduction to Bladerunner's object extensions. It shows how most Bladerunner objects can be accessed dynamically using object syntax. Showprop accesses and changes different properties of the Bladerunner frame and Command windows, creates sparse arrays using the object syntax, and shows how you can use the enum() function to view all the properties of an object. TESTCLAS.PRG ------------ This program shows how to use Bladerunner's object syntax to create base classes and derived classes. It defines 2 classes -- MyClass and Base, and a class Derived, which is derived from the Base class. It then creates instances of each of these classes, and displays their properties. WINAPI.PRG ---------- Files used: Sampproc.prg Calls: Sampproc.prg, GetVersion(),GetWinFlags(),GetModuleUsage(),GetModuleHandle(), GetVersion(),ShowWindow(),GetFreeSpace(),SystemParametersInfo(), messagebox(),SystemParametersInfo(),CloseWindow(),OpenIcon(), GetWindowText(),CloseWindow(),OpenIcon(),GetWindowsDirectory() (external functions) This program gives extensive examples of how you can use Bladerunner's API interface to access Windows' functions and obtain useful information. It brings up a window that lets you select what external functions/groups of functions you would like to execute, and then executes your selection. You can get various system information, bring up Windows dialogs, minimize/maximize Bladerunner windows, and much more.